package com.liuzh.deviceinfo.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Cap;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.view.MotionEvent;
import android.view.View;
import c.h.a.m0.h;

public class ScreenDrawView extends View {
    public Path a = new Path();
    public Paint b = new Paint(1);

    public ScreenDrawView(Context context) {
        super(context);
        setBackgroundColor(-7829368);
        this.b.setColor(-16777216);
        this.b.setStyle(Style.STROKE);
        this.b.setStrokeWidth((float) h.t(4.0f, getResources().getDisplayMetrics()));
        this.b.setStrokeCap(Cap.ROUND);
    }

    public void onDraw(Canvas canvas) {
        canvas.drawPath(this.a, this.b);
    }

    public boolean onTouchEvent(MotionEvent motionEvent) {
        int action = motionEvent.getAction();
        if (action == 0) {
            this.a.moveTo(motionEvent.getX(), motionEvent.getY());
        } else if (action == 2) {
            this.a.lineTo(motionEvent.getX(), motionEvent.getY());
        }
        invalidate();
        return true;
    }
}
